package com.blog.entity;

import java.io.Serializable;

import com.baomidou.mybatisplus.enums.IdType;
import com.baomidou.mybatisplus.annotations.TableId;
import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.activerecord.Model;
import com.blog.myUtils.DateTime;

import java.io.Serializable;

/**
 * <p>
 *
 * </p>
 *
 * @author mars123
 * @since 2019-07-02
 */
public class User extends Model<User> {

    private static final long serialVersionUID = 1L;
    public static final int STATUS_ACTIVE = 1;
    public static final int STATUS_FROBIDDEN = 0;


    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;
    private String username;
    private String email;
    private String phone;
    private String password;
    @TableField("password_rest_token")
    private String passwordRestToken;
    private Integer gender;
    private String description;
    private String avatar;
    @TableField("created_at")
    private Integer createdAt;
    @TableField("updated_at")
    private Integer updatedAt;
    @TableField("login_at")
    private Integer loginAt;
    private Integer status;
    private Integer islogin;

    public String getCreatedTime() {
        return createdAt == null ? "-" : DateTime.format(createdAt);
    }

    public String getUpdatedTime() {
        return updatedAt == null ? "-" : DateTime.format(updatedAt);
    }


    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getPasswordRestToken() {
        return passwordRestToken;
    }

    public void setPasswordRestToken(String passwordRestToken) {
        this.passwordRestToken = passwordRestToken;
    }

    public Integer getGender() {
        return gender;
    }

    public void setGender(Integer gender) {
        this.gender = gender;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public String getAvatar() {
        return avatar;
    }

    public void setAvatar(String avatar) {
        this.avatar = avatar;
    }

    public Integer getCreatedAt() {
        return createdAt;
    }

    public void setCreatedAt(Integer createdAt) {
        this.createdAt = createdAt;
    }

    public Integer getUpdatedAt() {
        return updatedAt;
    }

    public void setUpdatedAt(Integer updatedAt) {
        this.updatedAt = updatedAt;
    }

    public Integer getLoginAt() {
        return loginAt;
    }

    public void setLoginAt(Integer loginAt) {
        this.loginAt = loginAt;
    }

    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    public Integer getIslogin() {
        return islogin;
    }

    public void setIslogin(Integer islogin) {
        this.islogin = islogin;
    }

    @Override
    protected Serializable pkVal() {
        return this.id;
    }

    @Override
    public String toString() {
        return "User{" +
                "id=" + id +
                ", username=" + username +
                ", email=" + email +
                ", phone=" + phone +
                ", password=" + password +
                ", passwordRestToken=" + passwordRestToken +
                ", gender=" + gender +
                ", description=" + description +
                ", avatar=" + avatar +
                ", createdAt=" + createdAt +
                ", updatedAt=" + updatedAt +
                ", loginAt=" + loginAt +
                ", status=" + status +
                ", islogin=" + islogin +
                "}";
    }
}
